// levelmanager.h
#ifndef LEVELMANAGER_H
#define LEVELMANAGER_H

#include <QObject>
#include <QStringList>
#include <QMap>
#include "mapdata.h"
#include "mapmanager.h"

class LevelManager : public QObject {
    Q_OBJECT

public:
    explicit LevelManager(QObject *parent = nullptr);

    bool loadLevelList(const QString &directory);
    int currentLevel() const { return m_currentLevel; }
    int totalLevels() const { return m_levelFiles.size(); }

public slots:
    bool setLevel(int level);
    bool nextLevel();
    bool prevLevel();

signals:
    void levelLoaded(const MapData &mapData);
    void levelChanged(int current, int total);
    void loadFailed(const QString &error);

private:
    MapManager m_mapManager;
    QStringList m_levelFiles;
    int m_currentLevel = -1;
    QString m_levelDirectory;
};

#endif // LEVELMANAGER_H
